package com.itheima.work01;

public class Student implements Comparable<Student>{
    private String sid;
    private String name;

    public Student() {
    }

    public Student(String sid, String name) {
        this.sid = sid;
        this.name = name;
    }

    public String getSid() {
        return sid;
    }

    public void setSid(String sid) {
        this.sid = sid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Student{" +
                "sid='" + sid + '\'' +
                ", name='" + name + '\'' +
                '}';
    }

    @Override
    public int compareTo(Student o) {
        int i = o.getSid().compareTo(this.getSid());
        i=i==0?this.getName().compareTo(o.getName()):i;
        return i;
    }
}
